<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>图文详情</title>
  <style>
    * {margin: 0;padding: 0;}
    a {
      text-decoration: none;
    }
    .topBanner {
      width: 100%;
      height: 150px;
    }
    .topBanner img {
      width: 100%;
      height: 100%;
    }
    .ad-title {
      width: 95%;
      padding: 5px 0;
      margin: 0 auto;
    }
    .ad-title h5 {
      font-size: 17px;
      font-weight: 400;
      padding-bottom: 5px;
    }
    .ad-title p {
      color: #666;
      font-size: 14px;
    }
    .colorTip {
      width: 100%;
      height: 8px;
      background-color: #f1f1f1;
    }
    .useNowBox {
      width: 100%;
      height: 60px;
      background-color: #fff;
      position: fixed;
      bottom: 0;
      left: 0;
    }
    .useNowBox .useNowBtn {
      width: 95%;
      height: 40px;
      color: #fff;
      line-height: 40px;
      display: block;
      background-color: #11c3bc;
      margin: 10px auto;
      border-radius: 7px;
      text-align: center;
    }
    .mainallcontainer {
      padding-bottom: 80px;
    }
    .mainContent {
      padding: 0 10px;
      overflow: hidden;
    }
    .mainContent img {
      width:100%;
    }
    .backPreBtn {
      width: 35px;
      height: 35px;
      position: fixed;
      left: 10px;
      top: 10px;
      border-radius: 50%;
      display: -ms-flexbox;
      display: -webkit-box;
      display: flex;
      -ms-flex-pack: center;
      -webkit-box-pack: center;
      justify-content: center;
      -ms-flex-align: center;
      -webkit-box-align: center;
      align-items: center;
      background-color: rgba(254,41,71,.5);
      z-index: 1000;
    }
    .backPreBtn svg {
      fill: #fff;
      width: 1.4rem;
      height: 1.4rem;
    }
  </style>
  <script src = '//imgcow.oss-cn-hangzhou.aliyuncs.com/game/Js/jquery.min.js'></script>
  <script src = '//imgcow.oss-cn-hangzhou.aliyuncs.com/game/Js/template.js'></script>
  <script type = 'text/html' id = 'mainTemplate'>
  <div class = 'topBanner'>
    <div class = 'backPreBtn' id ='goBack' onclick= 'goBack()'>
      <svg style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
        <path d="M687.732364 172.450909 313.460364 511.488l374.295273 339.013818c13.079273 12.939636 13.079273 33.885091 0 46.801455-13.079273 12.939636-34.257455 12.939636-47.336727 0L242.106182 536.552727c-6.958545-6.888727-9.937455-16.034909-9.472-25.064727-0.465455-9.029818 2.513455-18.152727 9.472-25.064727L640.418909 125.649455c13.079273-12.916364 34.257455-12.916364 47.336727 0C700.811636 138.589091 700.811636 159.534545 687.732364 172.450909z"></path>
      </svg>
    </div>
    <img src="{{bannerUrl}}" alt="">
  </div>
  <div class="ad-title">
    <h5>{{couponTitle}}</h5>
    <p>有效期：{{startValid}}&nbsp;至&nbsp;{{endValid}}</p>
  </div>
  <div class = 'colorTip'></div>
  <div class="mainContent">
    <!-- 放富文本 -->
  </div>
  <div class="useNowBox">
    <a class="useNowBtn" href = '{{promoteUrl}}'>{{buttonText}}</a>
  </div>
  </script>
</head>
<body>
  <div class="mainallcontainer">

  </div>
</body>
</html>
<script>
if( window.history.length > 0 ) {
  //  window.history.go(-1);
}else {
  $('#goBack').css('display', 'none');
}

function goBack() {
   window.history.go(-1);
}
  var p = 'https:'==document.location.protocol;
  if(p) {
    var httpType = 'https:';
  }else {
    var httpType = 'http:';
  }
  var requestUrl = '//adbaitai.com/public/coupon/gain',
      locationStr = window.location.search.substr(1).split('=')[1],
      requestStr = '?data=%7bcouponId:'+locationStr+'%7d',
      newRequestUrl = requestUrl + requestStr;
  $.ajax({
    url: newRequestUrl,
    success: function(data) {
      console.log(JSON.parse(data)['data']['coupon']);
      var newDataArr = JSON.parse(data)['data']['coupon'];
      var temp = template('mainTemplate', newDataArr);
      $('.mainallcontainer').html(temp);
      $('.mainContent').html(newDataArr.description);
    }
  })
</script>
